import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;


public class Interfaz extends JFrame {
	
	private static final long serialVersionUID = 1L;
	
	private JPanel pPrincipal = null;
	private JTextField funcionTxt = null;
	private JTextField numGeneracionesTxt = null;
	private JTextField tamPoblacionTxt = null;
	private JTextField porcCruceTxt = null;
	private JTextField porcMutacionTxt = null;
	private JTextField valorDeNTxt = null;
	private JTextField precisionTxt = null;
	


	public Interfaz(){
		super("Practica 1 - Algoritmos geneticos");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setLayout(new BorderLayout());
		this.pPrincipal = getPanelPrincipal();
		this.add(pPrincipal, BorderLayout.CENTER);
	
		JButton botonGrafica = new JButton("Representacion grafica");
		botonGrafica.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e) {
				
				
			}
			
			
		});
		this.add(botonGrafica, BorderLayout.SOUTH);
	}
	
	
	private JPanel getPanelPrincipal() {
		JPanel pCentral = new JPanel(new GridLayout(7, 2, 6, 6));
		
		JLabel funcionLbl = new JLabel("Funci�n: ");
		pCentral.add(funcionLbl);
		this.funcionTxt = new JTextField();
		pCentral.add(this.funcionTxt);
		
		JLabel numGeneracionesLbl = new JLabel("N�mero de generaciones: ");
		pCentral.add(numGeneracionesLbl);
		this.numGeneracionesTxt = new JTextField();
		pCentral.add(this.numGeneracionesTxt);

		JLabel tamPoblacionLbl = new JLabel("Tama�o de poblaci�n: ");
		pCentral.add(tamPoblacionLbl);
		this.tamPoblacionTxt = new JTextField();
		pCentral.add(this.tamPoblacionTxt);
		
		JLabel porcCruceLbl = new JLabel("Porcentaje de cruce: ");
		pCentral.add(porcCruceLbl);
		this.porcCruceTxt = new JTextField();
		pCentral.add(this.porcCruceTxt);
		
		JLabel porcMutacionLbl = new JLabel("Porcentaje de mutaci�n: ");
		pCentral.add(porcMutacionLbl);
		this.porcMutacionTxt = new JTextField();
		pCentral.add(this.porcMutacionTxt);
		
		JLabel valorDeNLbl = new JLabel("Valor de N: ");
		pCentral.add(valorDeNLbl);
		this.valorDeNTxt = new JTextField();
		pCentral.add(this.valorDeNTxt);
		
		JLabel precisionLbl = new JLabel("Precisi�n: ");
		pCentral.add(precisionLbl);
		this.precisionTxt = new JTextField();
		pCentral.add(this.precisionTxt);
		
		return pCentral;
	}


	public String getFuncionTxt() {
		return funcionTxt.getText();
	}


	public String getNumGeneracionesTxt() {
		return numGeneracionesTxt.getText();
	}


	public String getTamPoblacionTxt() {
		return tamPoblacionTxt.getText();
	}


	public String getPorcCruceTxt() {
		return porcCruceTxt.getText();
	}


	public String getPorcMutacionTxt() {
		return porcMutacionTxt.getText();
	}


	public String getValorDeNTxt() {
		return valorDeNTxt.getText();
	}


	public String getPrecisionTxt() {
		return precisionTxt.getText();
	}


	public static void main(String[] args) {
		Interfaz interf = new Interfaz();
		interf.setSize(700, 500);
		interf.setVisible(true);

	}




}
